package generator.domain;

import java.math.BigDecimal;
import java.time.LocalDateTime;
import lombok.Data;

/**
 * 
 * @TableName coupons
 */
@Data
public class Coupons {
    /**
     * 优惠券主键
     */
    private Integer id;

    /**
     * 优惠券码
     */
    private String couponCode;

    /**
     * 优惠券名称
     */
    private String name;

    /**
     * 类型（固定金额/百分比）
     */
    private Object type;

    /**
     * 优惠值（固定金额/百分比值）
     */
    private BigDecimal value;

    /**
     * 最低消费金额
     */
    private BigDecimal minSpend;

    /**
     * 生效时间
     */
    private LocalDateTime validStart;

    /**
     * 失效时间
     */
    private LocalDateTime validEnd;

    /**
     * 总发行量
     */
    private Integer totalQuantity;

    /**
     * 剩余数量
     */
    private Integer remainingQuantity;

    /**
     * 适用商品类型（如["COURSE","TEST"]）
     */
    private Object applicableTypes;

    /**
     * 状态
     */
    private Object status;

    /**
     * 创建时间
     */
    private LocalDateTime createdAt;

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        Coupons other = (Coupons) that;
        return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
            && (this.getCouponCode() == null ? other.getCouponCode() == null : this.getCouponCode().equals(other.getCouponCode()))
            && (this.getName() == null ? other.getName() == null : this.getName().equals(other.getName()))
            && (this.getType() == null ? other.getType() == null : this.getType().equals(other.getType()))
            && (this.getValue() == null ? other.getValue() == null : this.getValue().equals(other.getValue()))
            && (this.getMinSpend() == null ? other.getMinSpend() == null : this.getMinSpend().equals(other.getMinSpend()))
            && (this.getValidStart() == null ? other.getValidStart() == null : this.getValidStart().equals(other.getValidStart()))
            && (this.getValidEnd() == null ? other.getValidEnd() == null : this.getValidEnd().equals(other.getValidEnd()))
            && (this.getTotalQuantity() == null ? other.getTotalQuantity() == null : this.getTotalQuantity().equals(other.getTotalQuantity()))
            && (this.getRemainingQuantity() == null ? other.getRemainingQuantity() == null : this.getRemainingQuantity().equals(other.getRemainingQuantity()))
            && (this.getApplicableTypes() == null ? other.getApplicableTypes() == null : this.getApplicableTypes().equals(other.getApplicableTypes()))
            && (this.getStatus() == null ? other.getStatus() == null : this.getStatus().equals(other.getStatus()))
            && (this.getCreatedAt() == null ? other.getCreatedAt() == null : this.getCreatedAt().equals(other.getCreatedAt()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
        result = prime * result + ((getCouponCode() == null) ? 0 : getCouponCode().hashCode());
        result = prime * result + ((getName() == null) ? 0 : getName().hashCode());
        result = prime * result + ((getType() == null) ? 0 : getType().hashCode());
        result = prime * result + ((getValue() == null) ? 0 : getValue().hashCode());
        result = prime * result + ((getMinSpend() == null) ? 0 : getMinSpend().hashCode());
        result = prime * result + ((getValidStart() == null) ? 0 : getValidStart().hashCode());
        result = prime * result + ((getValidEnd() == null) ? 0 : getValidEnd().hashCode());
        result = prime * result + ((getTotalQuantity() == null) ? 0 : getTotalQuantity().hashCode());
        result = prime * result + ((getRemainingQuantity() == null) ? 0 : getRemainingQuantity().hashCode());
        result = prime * result + ((getApplicableTypes() == null) ? 0 : getApplicableTypes().hashCode());
        result = prime * result + ((getStatus() == null) ? 0 : getStatus().hashCode());
        result = prime * result + ((getCreatedAt() == null) ? 0 : getCreatedAt().hashCode());
        return result;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", id=").append(id);
        sb.append(", couponCode=").append(couponCode);
        sb.append(", name=").append(name);
        sb.append(", type=").append(type);
        sb.append(", value=").append(value);
        sb.append(", minSpend=").append(minSpend);
        sb.append(", validStart=").append(validStart);
        sb.append(", validEnd=").append(validEnd);
        sb.append(", totalQuantity=").append(totalQuantity);
        sb.append(", remainingQuantity=").append(remainingQuantity);
        sb.append(", applicableTypes=").append(applicableTypes);
        sb.append(", status=").append(status);
        sb.append(", createdAt=").append(createdAt);
        sb.append("]");
        return sb.toString();
    }
}